package com.feiniu.api.util;

import org.apache.commons.io.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.servlet.http.HttpServletRequest;

public class IoUtil {
    private static final Logger LOGGER = LoggerFactory.getLogger(IoUtil.class);
    private static final String ENCODING = "utf-8";

    public static String getPostBody(HttpServletRequest request) {
        try {
            return IOUtils.toString(request.getInputStream(),ENCODING);
        } catch (Exception e) {
            LOGGER.error(e.getMessage(), e);
        }
        return "";
    }

}
